package logic

import (
	"context"
	"jd-mall/jd_srv/jdsrvclient"

	"jd-mall/api/internal/svc"
	"jd-mall/api/internal/types"

	"github.com/zeromicro/go-zero/core/logx"
)

type ShopExamineLogic struct {
	logx.Logger
	ctx    context.Context
	svcCtx *svc.ServiceContext
}

func NewShopExamineLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ShopExamineLogic {
	return &ShopExamineLogic{
		Logger: logx.WithContext(ctx),
		ctx:    ctx,
		svcCtx: svcCtx,
	}
}

func (l *ShopExamineLogic) ShopExamine(req *types.ShopExamineRequest) (resp *types.Response, err error) {
	// todo: add your logic here and delete this line
	examine, err := l.svcCtx.JdSrv.ShopExamine(l.ctx, &jdsrvclient.ShopExamineRequest{
		ShopId: int64(req.ShopId),
	})
	if err != nil {
		return &types.Response{
			Code: -1,
			Msg:  "审核失败",
			Data: nil,
		}, nil
	}
	return &types.Response{
		Code: 200,
		Msg:  "审核成功",
		Data: examine,
	}, nil
}
